package com.tc.qichacha.validator;

import com.baidu.unbiz.fluentvalidator.Validator;
import com.baidu.unbiz.fluentvalidator.ValidatorContext;
import com.baidu.unbiz.fluentvalidator.ValidatorHandler;
import com.tc.qichacha.base.BaseResponse;
import lombok.extern.java.Log;

@Log
public class BaseResponseValidator extends ValidatorHandler<BaseResponse> implements Validator<BaseResponse> {
    @Override
    public boolean validate(ValidatorContext context, BaseResponse baseResponse) {
        if("200".equals(baseResponse.getStatus())){
            log.info("响应成功");
        }else {
            context.addErrorMsg("响应失败:"+baseResponse.getMessage());
            return false;
        }
        return true;
    }
}
